#ifndef MONSTER_H
#define MONSTER_H

#include <vector>

#include "mapobj.h"

class Item;
class Armor;
class Weapon;

class Monster : public MapObject
{
public:
	Monster( int x, int y, stats_t = stats_standard, skills_t = skills_standard,
		std::string name = "Monster", char symbol = 'm' );
	Monster( const monster_t &, int x, int y );
	Monster();
	virtual ~Monster();
	void setMonster( map * m, int x, int y, stats_t = stats_standard, skills_t = skills_standard,
		std::string name = "Monster", char symbol = 'm' );
	DECLARE_INSTANCE;
	using MapObject::setPos;
	virtual int setPos( int x, int y ) override;
	virtual int setMapPos( map * m, int x, int y ) override;
	virtual bool move( int direction ) override;
	virtual bool moveAttack( int direction );
	bool openDoor( Tile * );
	bool openDoor( int direction );
	bool closeDoor( Tile * );
	bool closeDoor( int direction );
// Health and combat related
	int getHealth() const;
	void adjustHealth( int );
	void setHealth( int );
	void heal( int );
	void harm( int );
	bool isDead() const;
	bool attackOld( Monster * );
	bool attack( Monster * );
	virtual void hitEffect( int force ) override;
	bool kick( Monster * );
	int fly( int direction, int length = -1 );
	inline int fly( MapObject *, int length = -1 );
	bool consume( MapObject * m );
	bool consume( Consumable * );
// Inventory
	void pickUp( Item * );
	void drop( Item * );
	bool invRemove( Item * );
	bool invRemoveDrop( Item * );
	bool invAdd( Item * );
	bool invFind( Item * );
// Attributes
	int getStr() const;
	int getAgl() const;
	int getInt() const;
	int getEnd() const;
// Armor, weapon
	int getProtection() const;
	int getDamage() const;
	bool wear( Armor * );
	bool wear( MapObject * );
	bool takeOff( Armor * );
	bool takeOff( MapObject * );
	bool wield( MapObject * );
	bool wield( Weapon * );
	bool sheathe( MapObject * );
	bool sheathe( Weapon * );
	bool shoot( MapObject * );
	Weapon * getWeapon() const;
	Armor * getArmor() const;


	std::vector< Item * > items;
	unsigned int defaultColor;
protected:
	bool die();
	bool revive();


	stats_t stats;
	skills_t skills;
	int health;
	bool dead;
	Armor * armor;
	Weapon * weapon;
};

#endif